'use strict';
/**
 * 员工Ocr
 */
module.exports = app => {
  const { STRING, UUID, NOW, DATE, UUIDV4, INTEGER } = app.Sequelize;

  const videoPartner = app.model.define('videoPartner', {
    id: {
      type: UUID,
      primaryKey: true,
      allowNull: false,
      defaultValue: UUIDV4,
      comment: '用户id'
    },
    initEnterNum: {
      type: INTEGER,
      field: 'init_enter_num',
      comment: '入口初始值'
    },
    initOutNum: {
      type: INTEGER,
      field: 'init_out_num',
      comment: '出口口初始值'
    },
    partnerName: {
      type: STRING(36),
      field: 'partner_name',
      comment: '设备名称'
    },
    partnerRemark: {
      type: STRING(100),
      field: 'partner_remark',
      comment: '设备名称'
    },
    enterCameraName: {
      type: STRING(36),
      field: 'enter_camera_name',
      comment: '入口设备名称'
    },
    enterCameraIp: {
      type: STRING(36),
      field: 'enter_camera_ip',
      comment: '入口设备IP'
    },
    enterCameraRemark: {
      type: STRING(36),
      field: 'enter_camera_remark',
      comment: '入口设备备注'
    },
    outCameraName: {
      type: STRING(36),
      field: 'out_camera_name',
      comment: '出口设备名称'
    },
    outCameraIp: {
      type: STRING(36),
      field: 'out_camera_ip',
      comment: '出口设备ip'
    },
    outCameraRemark: {
      type: STRING(36),
      field: 'out_camera_remark',
      comment: '出口设备备注'
    },
    monitorNums: {
      type: STRING(36),
      field: 'monitor_nums',
      comment: '理论滞留车辆数'
    },
    monitorSeconds: {
      type: STRING(36),
      field: 'monitor_seconds',
      comment: '理论行驶时间'
    },
    monitorNumsUnusualDate: {
      type: DATE,
      field: 'monitor_nums_unusual_date',
      comment: '滞留车辆数异常发生时间'
    },
    monitorSecondsDate: {
      type: DATE,
      field: 'monitor_seconds_date',
      comment: '理论行驶时间异常发生时间'
    },
    status: {
      type: INTEGER,
      field: 'status',
      comment: '1、设防中，2、滞留车辆数预警，3、滞留时间预警，4，警报中，5，排查中，6，停止设防'
    },
    maxPercent: {
      type: STRING(36),
      field: 'max_percent',
      comment: '预警比例值'
    },
    createDate: {
      type: DATE,
      defaultValue: NOW,
      field: 'create_date',
      comment: '创建时间'
    },
    updateDate: {
      type: DATE,
      defaultValue: NOW,
      field: 'update_date',
      comment: '更新时间'
    }
  }, {
    // 去除createAt，updateAt
    timestamps: false,
    // 实例对应的表名    
    tableName: 'video_partner',
    // 将createdAt对应到数据库的created_at字段
    createdAt: 'create_date',
    // 将updatedAt对应到数据库的updated_at字段
    updatedAt: 'updated_date'
  });

  return videoPartner;

};